/* picture.cpp */

#include <dodo_plot/kernel/picture.h>
#include <dodo_plot/kernel/p_node.h>
#include <dodo_plot/kernel/plotter.h>

#ifdef DEBUG
#include <dodo_plot/kernel/basic_elements.h>
#include <iostream>
#endif

namespace dodo_plot
{
using namespace std;

Picture::Picture(const Picture& orig) :
	p_(orig.p_)
{
	orig.p_->use_count_++;
}

Picture::Picture(P_Node* p_node, int dum) : p_(p_node) { }

Picture::~Picture()
{
	if(--p_->use_count_ == 0)
		delete p_;
}

Picture& Picture::operator= (const Picture& orig)
{
	orig.p_->use_count_++;
	if(--p_->use_count_ == 0)
		delete p_;
	p_ = orig.p_;
	return *this;
}

double Picture::height() const
{
	return p_->height();
}

double Picture::width() const
{
	return p_->width();
}

Position Picture::local_pos() const
{
	return Position(p_->local_pos());
}

void Picture::draw(const Plotter& plotter) const
{
	p_->draw(plotter);
}

//string& Picture::name()
//{
//	return p_->name();
//}

}
